I wanted to build a start button and after clicking on that I wanted to talk to vapi. I have public, private, assistance, workflow ids. But I am not being able to connect at all. here's the code i used.
import React from "react";
import Vapi from "
@Vapi-ai/web";
const FRONTEND_KEY = import.meta.env.VITE_VAPI_FRONTEND;
const ASSISTANT_ID = import.meta.env.VITE_VAPI_ASSISTANT;
export default function App() {
let vapi = null; // hold the instance
const startCall = async () => {
vapi = new Vapi(FRONTEND_KEY); // create instance
await vapi.start(ASSISTANT_ID); // start call
console.log("Call started");
};
const stopCall = async () => {
if (vapi) {
await vapi.stop(); // stop call
console.log("Call stopped");
}
};
return (
<>
Vapi 2.x Call Test
Start
Stop
);
}
But i keep getting error 'Vapi is not a contructor'
https://cdn.discordapp.com/attachments/1444610545738055750/1444610546057084938/Screenshot_2025-11-30_102320.png?ex=694e4b69&is=694cf9e9&hm=200ae46147c1cde53d7b21eddb077aef976c346f34c0e587475624f1d0d46b0b&